package pl.kollek;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class ArticleActivity extends Activity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.article);
                
                TextView feedTitle = (TextView)findViewById(R.id.title);
                TextView articleTitle = (TextView)findViewById(R.id.articleTitle);
                TextView articleContent = (TextView)findViewById(R.id.articleContent);
                Button btnArticleUrl = (Button)findViewById(R.id.btnOpenArticleUrl);
                
                final Intent intent = getIntent();
                feedTitle.setText(intent.getStringExtra("feedTitle"));
                articleTitle.setText(intent.getStringExtra("articleTitle"));
                articleContent.setText(intent.getStringExtra("articleContent"));
                
                btnArticleUrl.setOnClickListener(new OnClickListener() {
                        @Override
                        public void onClick(View arg0) {
                                Intent buttonIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(intent.getStringExtra("articleUrl")));
                                startActivity(buttonIntent);
                        }
                });
        }

}
